#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2020/8/30 16:02
# @USER    : Shengji He
# @File    : ReverseWordsString3.py
# @Software: PyCharm
# @Version  : Python-
# @TASK:


class Solution:
    def reverseWords(self, s: str) -> str:
        """
        Given a string, you need to reverse the order of characters in each word within a sentence while still
        preserving whitespace and initial word order.

        Example 1:
        Input: "Let's take LeetCode contest"
        Output: "s'teL ekat edoCteeL tsetnoc"
        Note: In the string, each word is separated by single space and there will not be any extra space in the string.

        :param s:
        :return:
        """
        # return ' '.join(i[::-1] for i in s.split())
        temp = s[::-1]
        temp = temp.split(' ')[::-1]
        return ' '.join(temp)


if __name__ == '__main__':
    print('done')
